//
//  BTSearchBar.m
//  BaxTer
//
//  Created by wsj2015 on 2016/12/22.
//  Copyright © 2016年 陈武琦. All rights reserved.
//

#import "BTSearchBar.h"
#import "UISearchBar+VDInnerComponents.h"
@implementation BTSearchBar



+ (instancetype)searchBarWithDelegate:(id)delegate{
   
    BTSearchBar *searchbar = [[self alloc] init];
    searchbar.delegate = delegate;
    
    return  searchbar;
    
}

- (instancetype)init
{
    self = [super init];
    if (self) {
        self.frame = CGRectMake(0, 0, kScreenWidth- 200, 33);
        self.placeholder = @"请输入您要搜索的内容";
     
        self.translucent = YES;
        self.searchBarStyle = UIBarStyleBlackTranslucent;
        self.tintColor = kTxtColor;
        
        self.contentMode = UIViewContentModeLeft;
        UITextField *tf =[self vd_inputTextField];
        tf.layer.borderWidth = 1;
        tf.layer.borderColor = [UIColor clearColor].CGColor;
        tf.textColor = [UIColor grayColor];
        tf.backgroundColor = [UIColor whiteColor];
        tf.layer.cornerRadius = 14;
        tf.layer.masksToBounds = YES;
        
        [tf setValue:[UIColor grayColor]
          forKeyPath:@"_placeholderLabel.textColor"];
        
        tf.borderStyle =UITextBorderStyleNone;
        tf.backgroundColor = [UIColor clearColor];
        
        tf.background = [UIImage imageNamed:@"white_bg"];
        
        
        tf.layer.masksToBounds = YES;
        tf.layer.cornerRadius = 4;

    }
    return self;
}

@end
